package vek.XML.Parsers;

import org.xml.sax.helpers.DefaultHandler;
import java.util.ArrayList;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

/**
 * Parses the update XML file
 * @see XMLParserPOI
 * @author Christian, Michal og Jakob (Hold 1, gruppe 2)
 */
public class XMLParserUpdate extends DefaultHandler{
    
    private String tempElementData;
    private ArrayList<String> listOfXMLFiles = new ArrayList<String>();
    
    public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
        
    }
    
    public void endElement(String uri, String localName, String qName) throws SAXException {
        
        if( localName.equalsIgnoreCase("path"))
        {
            listOfXMLFiles.add(tempElementData);
        }
        
        
    }
    
    public void characters(char[] ch, int start, int length) throws SAXException {
        
       tempElementData = new String(ch, start, length);
        
    }
    
    public ArrayList<String> getListOfXMLFiles()
    {
        return listOfXMLFiles;
    }

}
